<template>
	<div class="SMinfo">
		<div class="my-app">
			<h2 class="my-h2" v-if="type==='1'">商户信息/景区详情</h2>
			<h2 class="my-h2" v-if="type==='2'">商户信息/酒店详情</h2>

			<div class="el-radio-type infoel-radio-type">
				<div class="tit-nav">

					<span class="title">设置营业状态：</span>
					<el-radio v-model="radio" :label="1">正常营业</el-radio>
					<el-radio v-model="radio" :label="2">停止营业</el-radio>
				</div>
				<div class="tit-nav">
					<span>开始时间：</span>
					<el-time-picker @change="timepicker" is-range v-model="startend_time" value-format="HH:mm:ss" range-separator="至"
					 start-placeholder="开始时间" end-placeholder="结束时间" placeholder="选择时间范围">
					</el-time-picker>
				</div>
			</div>
			<div class="info-con">

				<div class="colmn my-form-item">
					<div class="row">
						<h3 class="my-h3c">上传公司logo图片（限1张）</h3>
						<div class="body-bor text-body-bor uploadone">
							<el-upload drag action="" :auto-upload="false" list-type="picture-card" :on-change="logochange">
								<img width="100%" :src="uploadlogo" alt="" v-if="upload_logo">
								<img class="upload-icon" v-else src="../../../assets/img/sys/upload.png" />
							</el-upload>
						</div>
						<h3 class="my-h3c" v-if="type==='1'">上传景区封面（限1张）</h3>
						<h3 class="my-h3c" v-if="type==='2'">上传酒店封面（限1张）</h3>
						<div class="body-bor text-body-bor uploadone">
							<el-upload drag action="" :auto-upload="false" list-type="picture-card" :on-change="coverchange">
								<img width="100%" :src="uploadone" alt="" v-if="upload_one">
								<img class="upload-icon" v-else src="../../../assets/img/sys/upload.png" />
							</el-upload>
						</div>
					</div>
					<div class="row">
						<h3 class="my-h3c" v-if="type==='1'">上传景区轮播图（限5张）</h3>
						<h3 class="my-h3c" v-if="type==='2'">上传酒店轮播图（限5张）</h3>
						<div class="body-bor text-body-bor">
							<el-upload action="" multiple drag :auto-upload="false" :limit="5" :file-list="fileList2" list-type="picture-card"
							 :on-change="rChartchange" :on-remove="handleRemove" :on-exceed="onexceed">
								<img class="upload-icon" v-if="upload_five" src="../../../assets/img/sys/upload.png" />
							</el-upload>
							<el-dialog drag :visible.sync="dialogVisible">
								<img width="100%" :src="dialogImageUrl" alt="">
							</el-dialog>
						</div>
					</div>
				</div>
				
				<div class="my-form-item" style="display: flex;line-height: 40px;">
					<h3 class="my-h3c">客服电话</h3>
					<el-input style="width: 660px;margin-left: 10px;" v-model="phone"></el-input>
				</div>
				<div class="my-form-item">
					<h3 class="my-h3c" v-if="type==='1'||type==='0'">景区类型</h3>
					<h3 class="my-h3c" v-if="type==='2'">酒店类型</h3>
					<div class="body-bor" v-show="type==='1'||type==='0'">
						<el-checkbox-group v-model="typecheckList" @change="handleCheckedCitiesChange">
							<el-checkbox v-for="(label, key, index) in typecheckbox1" :key="index" :label="label">{{label}}</el-checkbox>
						</el-checkbox-group>
					</div>
					<div class="body-bor" v-show="type==='2'">
						<el-checkbox-group v-model="typecheckList" @change="handleCheckedCitiesChange">
							<el-checkbox v-for="(label, key, index) in typecheckbox2" :key="index" :label="label">{{label}}</el-checkbox>
						</el-checkbox-group>
					</div>
				</div>
				<div class="my-form-item">
					<h3 class="my-h3c">设施服务</h3>
					<div class="body-bor" v-show="type==='1'||type==='0'">
						<el-checkbox-group v-model="servercheckList" @change="servercheckListChange">
							<el-checkbox v-for="(label, key, index) in servercheckbox1" :key="index" :label="label">{{label}}</el-checkbox>
						</el-checkbox-group>
					</div>
					<div class="body-bor" v-show="type==='2'">
						<el-checkbox-group v-model="servercheckList" @change="servercheckListChange">
							<el-checkbox v-for="(label, key, index) in servercheckbox2" :key="index" :label="label">{{label}}</el-checkbox>
						</el-checkbox-group>
					</div>
				</div>
				<div class="my-form-item">
					<h3 class="my-h3c" v-if="type==='1'||type==='0'">景区介绍</h3>
					<h3 class="my-h3c" v-if="type==='2'">酒店介绍</h3>
					<div class="body-bor text-body-bor">
						<textarea class="my_editor" id="remarks" ref="remarks" v-model="Editor_remarks"></textarea>
					</div>
				</div>
				<div class="my-form-item">
					<h3 class="my-h3c">预订须知</h3>
					<div class="body-bor text-body-bor">
						<textarea class="my_editor" id="notes_to_buy" v-model="Editor_notes_to_buy"></textarea>
					</div>
				</div>
			</div>
			<div class="my-button">
				<el-button class="submit" @click="pcAddScenicsub">提交信息</el-button>
			</div>

		</div>
	</div>
</template>

<script>
	import {
		mapGetters,
		mapActions
	} from 'vuex';
	export default {
		data() {
			return {
				phone: "",
				Editor_remarks: '',
				Editor_notes_to_buy: '',
				editorInit: {
					selector: 'textarea',
					language_url: '../../../../static/tinymce/zh_CN.js',
					language: 'zh_CN',
					skin_url: '../../../../static/tinymce/skins/lightgray',
					height: 200,
					init_instance_callback: function(editors) {}
				},
				upload_one: false,
				uploadone: "",
				upload_logo: false,
				uploadlogo: "",
				upload_five: true,
				type: this.$route.params.type,
				startend_time: ['08:00:00', '20:00:00'],
				fileList2: [],
				sceniclist: [],
				NavName: "商户信息/商户详情",
				radio: 0,
				bodyinfo: [{
					label: "公司名称",
					name: "",
					textsta: true,
					buttonStart: false,
					buttonText: "",
					showpassword: false
				}],
				typecheckbox: [],
				typecheckbox1: [
					"风景名胜",
					"休闲度假",
					"历史人文",
					"文化小镇",
					"主题公园",
					"游乐演出",
					"农业观光",
					"农业小镇"
				],
				typecheckbox2: [
					"主题酒店",
					"快捷酒店",
					"商务酒店",
					"民宿客栈",
					"品牌连锁",
					"星级酒店",
					"公寓酒店",
					"度假营地",
				],
				typecheckList: [],
				servercheckbox: [],
				servercheckbox1: [
					"免费停车",
					"行李寄存",
					"演出表演",
					"观光车",
					"观光索道",
					"设施租赁",
					"餐厅服务",
					"景区WiFi",
					"纪念品商店",
					"休闲场所",
					"便利店",
					"景区讲解",
					"卫生间",
				],
				servercheckbox2: [
					'免费停车',
					'行李寄存',
					'演出表演',
					'设施租赁',
					'餐厅服务',
					'酒店WiFi',
					'休闲场所',
					'便利店',
				],
				servercheckList: [],
				isIndeterminate: true,

				dialogImageUrl: '',
				dialogVisible: false,
				AddScenic: {
					token: "", //String	 header传入
					status: 1, //	Number	 1营业,2未营业 允许值: 1, 2
					scenic_type: "", //	Array	 景区类型
					hardware_facilities: "", //	Array	 设施服务
					remarks: "", //	String	 景区介绍
					notes_to_buy: "", //	String 预定须知
					opening_start_time: "", //	String	 开放时间
					opening_end_time: "", //	String	 关闭时间
					face: "", //	String	 封面图片 
					scenic: [], //	Array 轮播图片
				},
				AddHotel: {
					token: "", //	String	 header传入
					status: 1, //	Number	 1营业,2未营业 允许值: 1, 2
					hotel_type: "", //	Array	 酒店类型
					hardware_facilities: "", //	Array	 设施服务
					remarks: "", //	String	 景区介绍
					notes_to_buy: "", //	String	 预定须知
					checkin_time: "", //	String	 入住时间
					leave_time: "", //	String	 退房时间
					face: "", //	String	 封面图片
					hotel: "", //	Array	 轮播图片
				},

			}
		},

		computed: {
			...mapGetters([
				'pcAddScenic',
				'pcAddHotel',
				'token',
				'UserInfo_data',
				'res_productInformation',
				'remarks',
				'notes_to_buy',
			]),
		},
		beforeRouteLeave(to, from, next) {
			this.getPcAddScenic(this.AddScenic)
			this.getPcAddHotel(this.AddHotel)
			this.getres_productInformation("")
			next();
		},
		created() {
			this.radio = 1;
			if (this.UserInfo_data.status[0] === '7') {
				this.$alert('请耐心等待公司信息审核完成', '提示', {
					confirmButtonText: '确定',
				});
			}
		},
		mounted() {

			let _this = this;
			_this.AddScenic.opening_start_time = _this.startend_time[0];
			_this.AddScenic.opening_end_time = _this.startend_time[1];
			_this.AddHotel.checkin_time = _this.startend_time[0];
			_this.AddHotel.leave_time = _this.startend_time[1];
			_this.getPcAddScenic(_this.AddScenic)
			_this.getPcAddHotel(_this.AddHotel)
			_this.productInformation()
			_this.tinymce();
		},
		beforeDestroy() {
			this.$tinymce.remove()
		},
		methods: {
			...mapActions({
				getPcAddScenic: 'getPcAddScenic',
				getPcAddHotel: 'getPcAddHotel',
				getres_productInformation: 'getres_productInformation',
				setremarks: 'setremarks',
				setnotes_to_buy: 'setnotes_to_buy',
			}),
			tinymce() {
				let _this = this;
				_this.$tinymce.baseURL = '/static/tinymce'
				_this.$tinymce.init({
					selector: "#remarks",
					language_url: '../../../../static/tinymce/zh_CN.js',
					language: 'zh_CN',
					plugins: [ //配置插件：可自己随意选择，但如果是上传本地图片image和imagetools是必要的
						'advlist autolink link image lists charmap  preview hr anchor pagebreak ',
					],
					//工具框，也可自己随意配置
					toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image ',
					image_advtab: true,
					table_default_styles: {
						width: '100%',
						borderCollapse: 'collapse'
					},
					image_title: false, // 是否开启图片标题设置的选择，这里设置否
					automatic_uploads: true,
					// 图片异步上传处理函数
					images_upload_handler: (blobInfo, success, failure) => {
						var formData;
						formData = new FormData();
						formData.append('images', blobInfo.blob(), blobInfo.filename());
						if(_this.type==='1'){
							_this.$api.uploadScenicFace(formData, _this.token, function(data) {
								success("http://www.ddmzj.com" + data.url);
							});
						}if(_this.type==='2'){
							_this.$api.uploadHotelFace(formData, _this.token, function(data) {
								success("http://www.ddmzj.com" + data.url);
							});
						}
					},
					init_instance_callback: function(editor) {
						editor.on('NodeChange Change input KeyUp', () => {
							_this.Editor_remarks = editor.getContent();
						});
					}
				}).then(resolve => {
					resolve[0].setContent(_this.Editor_remarks)
				});
				_this.$tinymce.init({
					selector: '#notes_to_buy',
					language_url: '../../../../static/tinymce/zh_CN.js',
					language: 'zh_CN',
					init_instance_callback: function(editor) {
						editor.on('keyup', () => {
							_this.Editor_notes_to_buy = editor.getContent();
						});
					}
				}).then(resolve => {
					resolve[0].setContent(_this.Editor_notes_to_buy)
				});
			},

			setproductInformation() {
				this.$api.GetproductInformation({
						token: this.token
					})
					.then(res => {
						if (res.code === 200) {
							this.fileList2 = []
							this.sceniclist = [];
							this.getres_productInformation(res.result)
							this.productInformation();
						}
					})
			},
			productInformation() {
				if (!this.res_productInformation) {
					return
				}
				if (this.type === '2') {
					this.radio = this.res_productInformation.status; //是否营业
					this.startend_time = [this.res_productInformation.checkin_time, this.res_productInformation.leave_time]; //开始时间结束时间
					for (var i = 0; i < this.res_productInformation.hotel.length; i++) {
						this.fileList2.push({
							url: "http://www.ddmzj.com" + this.res_productInformation.hotel[i]
						})
					}
					this.uploadone = "http://www.ddmzj.com" + this.res_productInformation.face; //封面图片
					this.upload_one = true;
					this.uploadlogo = "http://www.ddmzj.com" + this.res_productInformation.logo_url; //封面图片
					this.upload_logo = true;
					var typevalue=[];
					for (var i = 0; i < this.res_productInformation.hotel_type.length; i++) {
						typevalue.push(this.res_productInformation.hotel_type[i].title)
					}
					this.typecheckList = typevalue; //酒店类型
					var hardvalue=[];
					for (var i = 0; i < this.res_productInformation.hardware_facilities.length; i++) {
						hardvalue.push(this.res_productInformation.hardware_facilities[i].title)
					}
					this.servercheckList = hardvalue; //设施服务
					this.Editor_remarks = this.res_productInformation.remarks;
					this.Editor_notes_to_buy = this.res_productInformation.notes_to_buy;
					this.phone = this.res_productInformation.phone;
					var pcAddHotels = {
						status: this.res_productInformation.status, //	Number	 1营业,2未营业 允许值: 1, 2
						hotel_type: this.res_productInformation.hotel_type, //	Array	 酒店类型
						hardware_facilities: this.res_productInformation.hardware_facilities, //	Array	 设施服务
						remarks: this.Editor_remarks, //	String	 景区介绍
						notes_to_buy: this.Editor_notes_to_buy, //	String	 预定须知
						checkin_time: this.res_productInformation.checkin_time, //	String	 入住时间
						leave_time: this.res_productInformation.leave_time, //	String	 退房时间
						face: this.res_productInformation.face, //	String	 封面图片
						logo_url: this.res_productInformation.logo_url, //	String	 封面图片
						hotel: this.res_productInformation.hotel, //	Array	 轮播图片
					}
					this.getPcAddHotel(pcAddHotels)
				}
				if (this.type === '1') {
					this.radio = this.res_productInformation.status; //是否营业
					this.startend_time = [this.res_productInformation.opening_start_time, this.res_productInformation.opening_end_time]; //开始时间结束时间
					for (var i = 0; i < this.res_productInformation.scenic.length; i++) {
						this.fileList2.push({
							url: "http://www.ddmzj.com" + this.res_productInformation.scenic[i]
						})
					}
					this.uploadone = "http://www.ddmzj.com" + this.res_productInformation.face; //封面图片
					this.upload_one = true;
					this.uploadlogo = "http://www.ddmzj.com" + this.res_productInformation.logo_url; //封面图片
					this.upload_logo = true;
					var typevalue=[];
					for (var i = 0; i < this.res_productInformation.scenic_type.length; i++) {
						typevalue.push(this.res_productInformation.scenic_type[i].title)
					}
					this.typecheckList = typevalue; //酒店类型
					var hardvalue=[];
					for (var i = 0; i < this.res_productInformation.hardware_facilities.length; i++) {
						hardvalue.push(this.res_productInformation.hardware_facilities[i].title)
					}
					this.servercheckList = hardvalue; //设施服务
					this.Editor_remarks = this.res_productInformation.remarks;
					this.Editor_notes_to_buy = this.res_productInformation.notes_to_buy;
					this.phone = this.res_productInformation.phone;
					var pcAddHotels = {
						status: this.res_productInformation.status, //	Number	 1营业,2未营业 允许值: 1, 2
						scenic_type:  this.res_productInformation.scenic_type, //	Array	 酒店类型
						hardware_facilities:  this.res_productInformation.hardware_facilities, //	Array	 设施服务
						remarks: this.Editor_remarks, //	String	 景区介绍
						notes_to_buy: this.Editor_notes_to_buy, //	String	 预定须知
						opening_start_time: this.res_productInformation.opening_start_time, //	String	 入住时间
						opening_end_time: this.res_productInformation.opening_end_time, //	String	 退房时间
						logo_url: this.res_productInformation.logo_url, //	String	 封面图片
						face: this.res_productInformation.face, //	String	 封面图片
						scenic: this.res_productInformation.scenic, //	Array	 轮播图片
					}
					this.getPcAddScenic(pcAddHotels)
				}
			},
			pcAddScenicsub() {
				if (this.type == '1') {
					if (this.pcAddScenic.status === "") {
						this.$alert('是否营业', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}

					if (this.pcAddScenic.opening_start_time === "") {
						this.$alert('请选择开放时间', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddScenic.opening_end_time === "") {
						this.$alert('请选择关闭时间', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddScenic.face === "") {
						this.$alert('请上传封面图片', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddScenic.scenic === "") {
						this.$alert('请上传轮播图片', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.phone === "") {
						this.$alert('请输入客服电话', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddScenic.scenic_type === "") {
						this.$alert('请选择景区类型', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddScenic.hardware_facilities === "") {
						this.$alert('请选择设施服务', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddScenic.remarks === "") {
						this.$alert('请输入景区介绍', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddScenic.notes_to_buy === "") {
						this.$alert('请输入预定须知', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}

					let req_pcAdd = JSON.parse(JSON.stringify(this.pcAddScenic)); //this.templateData是父组件传递的对象
					req_pcAdd["token"] = this.token;
					req_pcAdd["phone"] = this.phone;
					this.getPcAddScenic(req_pcAdd)
					this.$api.GetpcAddScenic(this.pcAddScenic)
						.then(res => {
							if (res.code === 200) {

								this.$alert(res.result.meg, '提示', {
									confirmButtonText: '确定',
									callback: action => {
										this.setproductInformation()
									}
								});
							} else {
								this.$alert(res.meg, '提示', {
									confirmButtonText: '确定',
								});
							}
						})
				}
				if (this.type == '2') {
					if (this.pcAddHotel.status === "") {
						this.$alert('是否营业', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddHotel.checkin_time === "") {
						this.$alert('请选择入住时间', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddHotel.leave_time === "") {
						this.$alert('请选择退房时间', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddHotel.face === "") {
						this.$alert('请上传封面图片', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddHotel.hotel === "") {
						this.$alert('请上传轮播图片', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddHotel.hotel_type === "") {
						this.$alert('请选择酒店类型', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.phone === "") {
						this.$alert('请输入客服电话', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddHotel.hardware_facilities === "") {
						this.$alert('请选择设施服务', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddHotel.remarks === "") {
						this.$alert('请输入景区介绍', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}
					if (this.pcAddHotel.notes_to_buy === "") {
						this.$alert('请输入预定须知', '提示', {
							confirmButtonText: '确定',
						});
						return;
					}

					let req_pcAdd = JSON.parse(JSON.stringify(this.pcAddHotel)); //this.templateData是父组件传递的对象
					req_pcAdd["token"] = this.token;
					req_pcAdd["phone"] = this.phone;
					this.getPcAddHotel(req_pcAdd)
					this.$api.GetpcAddHotel(this.pcAddHotel)
						.then(res => {
							if (res.code === 200) {
								this.$alert(res.result.meg, '提示', {
									confirmButtonText: '确定',
									callback: action => {
										this.setproductInformation();
									}
								});
							} else {
								this.$alert(res.meg, '提示', {
									confirmButtonText: '确定',
								});
							}
						})
				}
			},
			rChartchange(file, fileList) {
				let _this = this;
				let req_pcAdd = "";
				var windowURL = window.URL || window.webkitURL;
				_this.param = new FormData();
				_this.param.append('images', file.raw, file.name);
				if (_this.type == 1) {
					req_pcAdd = JSON.parse(JSON.stringify(_this.pcAddScenic)); //this.templateData是父组件传递的对象
					this.$api.uploadScenic(_this.param, _this.token, function(data) {
						_this.sceniclist.push(data.url);
						_this.fileList2.push({
							url: "http://www.ddmzj.com" + data.url
						});
						if (fileList.length >= 5) {
							_this.upload_five = false;
						}
						req_pcAdd.scenic = _this.sceniclist;
						_this.getPcAddScenic(req_pcAdd)
					});
				}
				if (_this.type == 2) {
					req_pcAdd = JSON.parse(JSON.stringify(_this.pcAddHotel)); //this.templateData是父组件传递的对象
					this.$api.uploadHotel(_this.param, _this.token, function(data) {
						_this.sceniclist.push(data.url);
						_this.fileList2.push({
							url: "http://www.ddmzj.com" + data.url
						});
						if (fileList.length === 5) {
							_this.upload_five = false;
						}
						req_pcAdd.hotel = _this.sceniclist;
						_this.getPcAddHotel(req_pcAdd)
					});
				}

			},
			onexceed(files, fileList) {
				this.$alert('最多上传5张轮播图', '提示', {
					confirmButtonText: '确定',
				});
			},
			handleRemove(file, fileList) {
				this.fileList2 = fileList;
				var req_pcAdd; //this.templateData是父组件传递的对象
				this.upload_five = true;
				if (this.type == 1) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddScenic)); //this.templateData是父组件传递的对象
					this.sceniclist = [];
					var reg = new RegExp("http://www.ddmzj.com", "g");
					for (var i = 0; i < this.fileList2.length; i++) {
						this.sceniclist.push(this.fileList2[0].url.replace(reg, ""));
					}
					req_pcAdd.scenic = this.sceniclist;
					this.getPcAddScenic(req_pcAdd)
				}
				if (this.type == 2) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddHotel)); //this.templateData是父组件传递的对象
					this.sceniclist = [];
					var reg = new RegExp("http://www.ddmzj.com", "g");
					for (var i = 0; i < this.fileList2.length; i++) {
						this.sceniclist.push(this.fileList2[0].url.replace(reg, ""));
					}
					req_pcAdd.hotel = this.sceniclist;
					this.getPcAddHotel(req_pcAdd)
				}
			},
			coverchange(file, fileList) {
				let _this = this;
				let req_pcAdd = "";
				var windowURL = window.URL || window.webkitURL;
				_this.param = new FormData();
				_this.param.append('images', file.raw, file.name);
				if (_this.type == 1) {
					req_pcAdd = JSON.parse(JSON.stringify(_this.pcAddScenic)); //this.templateData是父组件传递的对象
					this.$api.uploadScenicFace(_this.param, _this.token, function(data) {
						req_pcAdd.face = data.url;
						_this.uploadone = "http://www.ddmzj.com" + data.url;
						_this.upload_one = true;
						_this.getPcAddScenic(req_pcAdd)
					});
				}
				if (_this.type == 2) {
					req_pcAdd = JSON.parse(JSON.stringify(_this.pcAddHotel)); //this.templateData是父组件传递的对象
					this.$api.uploadHotelFace(_this.param, _this.token, function(data) {
						req_pcAdd.face = data.url;
						_this.uploadone = "http://www.ddmzj.com" + data.url;
						_this.upload_one = true;
						_this.getPcAddHotel(req_pcAdd)
					});
				}
			},
			logochange(file, fileList) {
				let _this = this;
				let req_pcAdd = "";
				var windowURL = window.URL || window.webkitURL;
				_this.param = new FormData();
				_this.param.append('images', file.raw, file.name);
				if (_this.type == 1) {
					req_pcAdd = JSON.parse(JSON.stringify(_this.pcAddScenic)); //this.templateData是父组件传递的对象
					this.$api.uploadScenicFace(_this.param, _this.token, function(data) {
						req_pcAdd.logo_url = data.url;
						_this.uploadlogo = "http://www.ddmzj.com" + data.url;
						_this.upload_logo = true;
						_this.getPcAddScenic(req_pcAdd)
					});
				}
				if (_this.type == 2) {
					req_pcAdd = JSON.parse(JSON.stringify(_this.pcAddHotel)); //this.templateData是父组件传递的对象
					this.$api.uploadHotelFace(_this.param, _this.token, function(data) {
						req_pcAdd.logo_url = data.url;
						_this.uploadlogo = "http://www.ddmzj.com" + data.url;
						_this.upload_logo = true;
						_this.getPcAddHotel(req_pcAdd)
					});
				}
			},
			timepicker() {
				let req_pcAdd = "";
				if (this.type == 1) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddScenic)); //this.templateData是父组件传递的对象
				}
				if (this.type == 2) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddHotel)); //this.templateData是父组件传递的对象
				}
				if (this.type == 1) {
					req_pcAdd.opening_start_time = this.startend_time[0];
					req_pcAdd.opening_end_time = this.startend_time[1];
					this.getPcAddScenic(req_pcAdd)
				}
				if (this.type == 2) {
					req_pcAdd.checkin_time = this.startend_time[0];
					req_pcAdd.leave_time = this.startend_time[1];
					this.getPcAddHotel(req_pcAdd)
				}
			},
			handleCheckedCitiesChange(value) {
				let req_pcAdd = "";
				if (this.type == 1) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddScenic)); //this.templateData是父组件传递的对象
					var typevalue = [];
					for (var i = 0; i < this.typecheckbox1.length; i++) {
						for (var s = 0; s < value.length; s++) {
							if (value[s] === this.typecheckbox1[i]) {
								typevalue.push({
									id: i,
									title: value[s]
								})
							}
						}
					}
					req_pcAdd.scenic_type = typevalue;
					this.getPcAddScenic(req_pcAdd)
				}
				if (this.type == 2) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddHotel)); //this.templateData是父组件传递的对象
					var typevalue = [];
					for (var i = 0; i < this.typecheckbox2.length; i++) {
						for (var s = 0; s < value.length; s++) {
							if (value[s] === this.typecheckbox2[i]) {
								typevalue.push({
									id: i,
									title: value[s]
								})
							}
						}
					}
					req_pcAdd.hotel_type = typevalue;
					this.getPcAddHotel(req_pcAdd)
				}
			},
			servercheckListChange(value) {
				let req_pcAdd = "";
				if (this.type == 1) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddScenic)); //this.templateData是父组件传递的对象
					var typevalue = [];
					for (var i = 0; i < this.servercheckbox1.length; i++) {
						for (var s = 0; s < value.length; s++) {
							if (value[s] === this.servercheckbox1[i]) {
								typevalue.push({
									id: i,
									title: value[s]
								})
							}
						}
					}
					req_pcAdd.hardware_facilities = typevalue;
					this.getPcAddScenic(req_pcAdd)
				}
				if (this.type == 2) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddHotel)); //this.templateData是父组件传递的对象
					var typevalue = [];
					for (var i = 0; i < this.servercheckbox2.length; i++) {
						for (var s = 0; s < value.length; s++) {
							if (value[s] === this.servercheckbox2[i]) {
								typevalue.push({
									id: i,
									title: value[s]
								})
							}
						}
					}
					req_pcAdd.hardware_facilities = typevalue;
					this.getPcAddHotel(req_pcAdd)
				}
			},
			getinput(res) {}
		},

		watch: {
			radio(newValue, oldValue) {
				let req_pcAdd = "";
				if (this.type == 1) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddScenic)); //this.templateData是父组件传递的对象
				}
				if (this.type == 2) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddHotel)); //this.templateData是父组件传递的对象
				}
				if (this.type == 1) {
					req_pcAdd.status = newValue;
					this.getPcAddScenic(req_pcAdd)
				}
				if (this.type == 2) {
					req_pcAdd.status = newValue;
					this.getPcAddHotel(req_pcAdd)
				}
			},
			Editor_remarks(newValue, oldValue) {
				// tinymce.activeEditor.setContent(newValue);
				let req_pcAdd = "";
				if (this.type == 1) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddScenic)); //this.templateData是父组件传递的对象
				}
				if (this.type == 2) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddHotel)); //this.templateData是父组件传递的对象
				}
				req_pcAdd.remarks = newValue;
				if (this.type == 1) {
					this.getPcAddScenic(req_pcAdd)
				}
				if (this.type == 2) {
					this.getPcAddHotel(req_pcAdd)
				}
			},
			Editor_notes_to_buy(newValue, oldValue) {
				let req_pcAdd = "";
				if (this.type == 1) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddScenic)); //this.templateData是父组件传递的对象
				}
				if (this.type == 2) {
					req_pcAdd = JSON.parse(JSON.stringify(this.pcAddHotel)); //this.templateData是父组件传递的对象
				}
				req_pcAdd['notes_to_buy'] = newValue;
				if (this.type == 1) {
					this.getPcAddScenic(req_pcAdd)
				}
				if (this.type == 2) {
					this.getPcAddHotel(req_pcAdd)
				}
			},

		},
	}
</script>

<style lang="less">
	.SMinfo {
		text-align: left;

		.infoel-radio-type {
			width: 100%;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 15px 5px;
			box-sizing: border-box;

			.tit-nav {
				display: flex;
				align-items: center;
			}

			.title {
				padding-right: 20px;
				box-sizing: border-box;
			}

			.el-radio {
				font-size: 16px;
				margin-right: 50px;
				color: #333;
			}

			.el-radio__input.is-checked+.el-radio__label {
				color: #333;
				font-size: 16px;
			}

			.el-radio__input.is-checked .el-radio__inner {
				border-color: #41c7db;
				background: #41c7db;
			}

			.el-radio__label {
				font-size: 16px;

			}

			.el-radio__inner {
				border-color: #8b8b8b;
			}
		}

		.info-con {
			width: 100%;
			box-sizing: border-box;
			border-bottom: 0;

			.body-bor {
				box-sizing: border-box;

				.el-checkbox-group {
					display: flex;
					flex-wrap: wrap;

					.el-checkbox {
						width: 25%;
						margin: 10px 0;
						text-align: left;
						padding: 0 40px;
						box-sizing: border-box;
					}
				}

				.el-checkbox__label {
					font-size: 16px;


				}
			}

			.text-body-bor {
				text-align: left;

				img {
					width: 150px;
					height: 100%;
				}
			}


			.el-upload--picture-card {
				border: none;
			}

			.uploadone {
				.el-upload-list {
					display: none;
				}
			}


			.colmn {
				display: flex;
				justify-content: space-between;
				position: relative;

				&::after {
					content: "*图片大小不能超过10M";
					position: absolute;
					top: 10px;
					right: 10px;
					color: red;
				}

				.row {
					text-align: center;

					&:first-child {
						width: 300px;

						.body-bor {
							padding: 10px 0;
							box-sizing: border-box;
							display: flex;
							align-items: center;
							justify-content: center;
						}
					}

					&:last-child {
						width: 615px;
						border-left: 2px solid #41c7db;

						.body-bor {
							padding: 20px 45px;
							box-sizing: border-box;
							height: 330px;
						}

					}
				}
			}

			.el-checkbox__input.is-checked+.el-checkbox__label {
				color: #333;
			}

			.el-checkbox__input.is-checked .el-checkbox__inner {}
		}


	}
</style>
